/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.com.ingsw.model;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author kerife
 */
@Entity
@Table(name = "historial")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Historial.findAll", query = "SELECT h FROM Historial h"),
    @NamedQuery(name = "Historial.findByNoCuenta", query = "SELECT h FROM Historial h WHERE h.historialPK.noCuenta = :noCuenta"),
    @NamedQuery(name = "Historial.findByIdAsignatura", query = "SELECT h FROM Historial h WHERE h.historialPK.idAsignatura = :idAsignatura"),
    @NamedQuery(name = "Historial.findByEstado", query = "SELECT h FROM Historial h WHERE h.estado = :estado"),
    @NamedQuery(name = "Historial.findByPromedio", query = "SELECT h FROM Historial h WHERE h.promedio = :promedio")})
public class Historial implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected HistorialPK historialPK;
    @Column(name = "estado")
    private Integer estado;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "promedio")
    private Float promedio;

    public Historial() {
    }

    public Historial(HistorialPK historialPK) {
        this.historialPK = historialPK;
    }

    public Historial(int noCuenta, int idAsignatura) {
        this.historialPK = new HistorialPK(noCuenta, idAsignatura);
    }

    public HistorialPK getHistorialPK() {
        return historialPK;
    }

    public void setHistorialPK(HistorialPK historialPK) {
        this.historialPK = historialPK;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public Float getPromedio() {
        return promedio;
    }

    public void setPromedio(Float promedio) {
        this.promedio = promedio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (historialPK != null ? historialPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Historial)) {
            return false;
        }
        Historial other = (Historial) object;
        if ((this.historialPK == null && other.historialPK != null) || (this.historialPK != null && !this.historialPK.equals(other.historialPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.com.ingsw.model.Historial[ historialPK=" + historialPK + " ]";
    }
    
}
